<template>
  <el-popconfirm v-loading="loading" :title="message" @onConfirm="confirm">
    <template #reference>
      <el-button :disabled="disabled" type="danger" style="padding: 9px;"><i class="el-icon-delete"></i></el-button>
    </template>
  </el-popconfirm>
</template>

<script>
export default {
  props: ["message", "deleteMethod", "disabled"],
  data() {
    return {
      loading: false
    };
  },
  methods: {
    confirm() {
      this.loading = true;
      this.deleteMethod().finally(() => {
        this.loading = false;
        this.$emit("delete");
      })
    }
  }
}
</script>

<style>

</style>